<?php


class News_mdl extends CI_Model
{
	const TB_ZIXUN = 'tb_zixun';
	
	public function __construct()
	{
		parent::__construct();
	}
	
	public function getNewsList( $page = true,$limit = 0, $offset = 0, $order = 'DESC' )
	{
		if($page){
			$this->db->limit( intval( $limit ) );
			$this->db->offset( intval( $offset ) );
			return $this->db->get(self::TB_ZIXUN)->result_array();
		}
		else {
			$reward = array();
			$reward = $this->db->get( self::TB_ZIXUN )->result_array();
			return $reward;
		}
	}
	
	
	public function getNewCount()
	{
		$count = 0;
		$count =  $this->db->count_all_results(self::TB_ZIXUN);

		return $count;
	}
	
	
	public function getZixunById( $id )
	{
		$zixun = $this->db->select( 'id,title,infos,content,rank' )
							->from( self::TB_ZIXUN )
							->where( 'id',$id )
							->get()
							->row_array();
		return $zixun;
	}
}